package com.example.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

//统一响应结果
@NoArgsConstructor
@AllArgsConstructor
@Data
public class result<T> {
    private Integer code;//业务状态码 0-成功 1-失败
    private String  message;//提示信息
    private T data;//响应数据

    public static <E> result<E> success(E data){
        return new result<>(0,"操作成功",data);
    }

    public static  result success(){
        return new result<>(0,"操作成功",null);
    }

    public static result error(String message){
        return new result<>(1,message,null);
    }


}
